package common.util;

import com.alibaba.fastjson.serializer.SerializerFeature;
import com.google.common.collect.Sets;
import org.springframework.http.MediaType;

import java.util.Arrays;
import java.util.List;
import java.util.Set;

/**
 * 全局常量
 *
 * @author 米泽鹏
 */
public class Constants {

	/**
	 * 手搓建筑名称
	 */
	public static final Set<String> HANDMADE_BUILDING_NAMES = Sets.newHashSet("制作台", "装备工坊");

	/**
	 * 服务名称
	 */
	public static final String SERVICE_NAME_GATEWAY = "gateway";
	public static final String SERVICE_NAME_LOG = "log";
	public static final String SERVICE_NAME_SYSTEM = "system";
	public static final String SERVICE_NAME_GAME = "game";
	/**
	 * 系统内置游客账号用户名
	 */
	public static final String INNER_VISITOR_USERNAME = "visitor";
	/**
	 * 修改用户名的最小时间间隔（天）
	 */
	public static final Integer MODIFY_USERNAME_INTERVAL_DAY = 180;
	/**
	 * 修改昵称的最小时间间隔（天）
	 */
	public static final Integer MODIFY_NICKNAME_INTERVAL_DAY = 30;
	/**
	 * 已删除账号用户名前缀
	 */
	public static final String DELETED_USERNAME_PREFIX = "DeletedUser";
	/**
	 * 已删除账号昵称前缀
	 */
	public static final String DELETED_NICKNAME_PREFIX = "用户已注销";
	/**
	 * 哈希循环次数
	 */
	public static final int HASH_ITERATIONS = 5;
	/**
	 * 用户密码盐长度
	 */
	public static final int PASSWORD_SALT_LENGTH = 16;
	/**
	 * 请求头 - token
	 */
	public static final String AUTHORIZATION_HEADER = "AuthorizationBearer";
	/**
	 * 请求头类型：
	 * application/x-www-form-urlencoded: form表单格式
	 * application/json: json格式
	 */
	public static final String HEADER_CONTENT_TYPE = MediaType.APPLICATION_JSON_VALUE;
	public static final SerializerFeature[] SERIALIZER_FEATURES = {SerializerFeature.DisableCircularReferenceDetect, SerializerFeature.WriteMapNullValue, SerializerFeature.PrettyFormat};
	public static final List<MediaType> SUPPORTED_MEDIA_TYPES = Arrays.asList(MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM);

	private Constants() {
		throw new AssertionError("不可实例化");
	}

}
